package org.fluidindia.ria.library.remoting
{
	/**
	 * Data structure representing end points to connect to a server.
	 * 
	 * This data structure is used to create AMF Channels.
	 * 
	 */
	public class Channel
	{
		private var server:String;
		private var port:String;
		private var servlet:String
		private var isSecure:Boolean;
		
		/**
		 * Default and inly constructor to create an end point
		 */
		public function Channel(server:String, port:String, servlet:String, isSecure:Boolean)
		{
			this.server = server;
			this.port = port;
			this.servlet = servlet;
			this.isSecure = isSecure;
		}

		public function getURL():String
		{
			var url:String = "";
			
			if(isSecure)
			{
				url = "https://";
			}
			else
			{
				url = "http://";
			}
			
			url = url + server
			
			if(port != null && port.length > 0)
			{
				url = url + ":" + port + "/";
			}
			
			url = url + servlet + "/messagebroker/amf";
			
			return url;
		}
	}
}